
import 'package:flutter_ahj_app/app/yhpc/YhpcApiRequest.dart';
import 'package:flutter_ahj_app/base/basewidget/model/BaseModel.dart';
import 'package:rxdart/rxdart.dart';

class HomeModel extends BaseModel {

  // 首页数据
  BehaviorSubject<Map> _homeMoudleDataObservable;
  Stream<Map> get getHomeMoudleStream => _homeMoudleDataObservable.stream;
  getHomeMoudle() {
    _homeMoudleDataObservable =  BehaviorSubject();
    YhpcApiRequest.homeMoudleApi().listen((result){
      _homeMoudleDataObservable.add(result);
    },onError: (e){
      _homeMoudleDataObservable.add(null);
      errorData.add(e);
    });
  }

  @override
  void dispose() {
    super.dispose();
    if (_homeMoudleDataObservable != null) _homeMoudleDataObservable.close();
  }
}
